package acm.europe2001.central;

import java.util.Scanner;

/*
 * p1476
 * ACM Central European 2001
 */

public class p1476 {

	static int d, n, o, p;

	public static void main(String[] args) {
		
		Scanner scanner = new Scanner(System.in);
		d = scanner.nextInt();
		for (int i=1;i<=d;++i) {
			n = scanner.nextInt();
			p = 0;
			while (n % 2 == 0) {
				n /= 2;
				p++;
			}
			o = n;
			System.out.println(o + " " + p);
		}

	}

}
